<?php

namespace App\Listeners;

use App\Events\WechatSubscribe;
use App\Interfaces\CouponService;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class SendCoupon
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    protected $couponService;
    public function __construct(CouponService $couponService)
    {
        $this->couponService=$couponService;
    }

    /**
     * Handle the event.
     *
     * @param  WechatSubscribe  $event
     * @return void
     */
    public function handle(WechatSubscribe $event)
    {
        //关注发放优惠券
       $user= $event->user;
       $this->couponService->sendCoupon($user);
    }
}
